ppp<template>
    <div class="box">
        <template v-for="item in menuData">
            <el-submenu :index="item.id+''" v-if="item.childMenu != null && item.childMenu.length>0" :key="item.id+''">
                <template slot="title" style="padding-left:30px">
                    <i :class="item.icon"></i>
                    <span slot="title">{{ item.menuName}}</span>
                </template>
                <Menu :menuData="item.childMenu"></Menu>
            </el-submenu>
            <el-menu-item v-else :index="item.url+''" :route="item.url" @click="savePath(item.url)" :key="item.id+''"
                style="padding-left: 50px;">
                <i :class="item.icon"></i>
                <span>{{item.menuName}}</span>
            </el-menu-item>
        </template>
    </div>
</template>

<script>
    export default {
        name: "Menu", //模板名称
        data() {
            return {

            };
        },
        beforeMount() {},
        props: ["menuData"],
        methods: {
            //保存激活路径
            savePath(path) {
                window.sessionStorage.setItem("activePath", path);
                this.activePath = path;
            },
        },
        created() {

        }
    };
</script>

<style>
    .el-menu--collapse span,
    .el-menu--collapse i.el-submenu__icon-arrow {
        height: 0;
        width: 0;
        overflow: hidden;
        visibility: hidden;
        display: inline-block;
    }

    .box {
        background-color: #272c33;
    }
</style>